/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.ace.dao;

import com.mysql.jdbc.Driver;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

import java.util.logging.Level;
import java.util.logging.Logger;
             

/**
 *
 * @author a.kanwar
 * Class contenant les méthodes de connexion et et déconnexion à la bdd
 */

public class Bdd {

    private Connection cnx;
    private String login = "root";
    private String mdp = "";
    private String url = "jdbc:mysql://localhost:3306/ace";

    public Connection seConnecter() throws ClassNotFoundException {
        try {
            Class.forName("com.mysql.jdbc.Driver");
            cnx = DriverManager.getConnection(url, login, mdp);

        } catch (SQLException ex) {
            Logger.getLogger(Bdd.class.getName()).log(Level.SEVERE, null, ex);
        }
        return cnx;
    }
    
    public void seDeconnecter(Connection connection) {
        try {
            connection.close();
        } catch (SQLException ex) {
            Logger.getLogger(Bdd.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
   
}
